<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>预约须知 - 五四宪法历史资料陈列室</title>
    <link rel="stylesheet" href="/static/pc/css/style.css">
    <script src="/static/pc/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/static/layui/layui/css/layui.css"  media="all">
    <script src="/static/layui/layui/layui.all.js"></script>
</head>
<body>
<style>
    .login span{
        margin-right:0px;
    }
    .login input{
        font-size: 0.3em;
    }
</style>
<div class="head">
    <img src="/static/pc/img/head.jpg" alt="">
</div>
<div class="main">
    <div class="title_img"><img src="/static/pc/img/title.png" alt=""></div>
    <div class="top_right">
<!--        {if condition="$active == null"}-->
<!--        {else /}-->
<!--        <a href="/activity_list" class="act_order">活动预约</a>-->
<!--        {/if}-->
        {if condition="$Think.session.mobile"}
        <a href="my_order?mobile={$Think.session.mobile}" class="my_orderlist" class=" canshu1" onclick="$('.login_layer').show()" >我的预约</a>
        {else /}
        <a href="javascript:;" class="my_orderlist" class=" canshu1" onclick="$('.login_layer').show()" >我的预约</a>
        {/if}
        {if condition="$Think.session.mobile"}<span class="login_status">{$Think.session.mobile}</span><a class="login_status" href="home_tuichu" onclick="$('.layer2').show()"> 退出</a>{/if}
    </div>
    <div class="clear"></div>
    <div class="content">
        {$result['content']}
        <br>
        <br>
        <br>
        <br>
        <input type="checkbox" onclick="agree(this)">我已阅读并同意参观须知条例

    </div>

    <div class="row" >
        <a href="javascript:;" class="zgyy"><img src="/static/pc/img/wyyyf.png" alt=""></a>
        {if $active != false}
        <a href="/activity_list" class="hdyy yy-btn">活动预约</a>
        {/if}

    </div>

<!--    滚动文字-->
    <div id="scroll_div" class="fl" style="display: block">
        <div id="scroll_begin">
            <span class="pad_right">
                {foreach $list as $k=>$v}
                {$v.content}
                {/foreach}
            </span>
        </div>
    </div>
</div>
{if condition="$Think.session.mobile"}
        <input type="hidden" class="style" value="{$Think.session.mobile}">
    {else/}
        <input type="hidden" class="style" value="0">
    <div class="login_layer layer">
        <div class="layer_box" style="margin-top: 21%">
            <a   onclick="$('.layer').hide()"><img src="/static/pc/img/close.png" alt=""></a>
            <div class="login">
                <p>
                    <span>手机号</span>
                    <input type="text" placeholder="请输入手机号" name="mobile" class="tell">
                </p>
                <p class="captcha_p">
                    <span>验证码</span>
                    <input type="text" name="code" placeholder="请输入验证码" class="code">
                    <a href="javascript:;" class="regsend" onclick="getVerifyCode(this)" style="max-width: 7em;font-size: 0.9em;line-height: 2em;">发送验证码</a>
                </p>
                <a  class="right"><img src="/static/pc/img/chax.png" width="80%" alt=""></a>
            </div>
        </div>
    </div>
{/if}
<script>
    //登录  查询我的预约
    $(".right").click(function(){
        var mobile = $(".tell").val();
        var code = $(".code").val();
        if(mobile==''||mobile.length<11){
            layer.alert("请输入输入正确手机号",{
                icon: 2,
                title:false,
                time:5000
            })
            return false;
        }
        if(code==''||code.length<4){
            layer.alert("请输入输入正确验证码",{
                icon: 2,
                title:false,
                time:5000
            })
            return false;
        }
        $.ajax({
            type: 'POST',
            url: 'login',
            data: {mobile:mobile,code:code},
            dataType:'json',
            success: function (eee) {
                console.log(eee);
                if(eee == 1){
                    // alert("请输入验证码");
                    layer.alert("请输入验证码",{
                        icon: 2,
                        title:false,
                        time:5000
                    })
                    return false;
                }
                if(eee == 2){
                    // alert("验证码已过期,请重新发送");
                    layer.alert("验证码已过期,请重新发送",{
                        icon: 2,
                        title:false,
                        time:5000
                    })
                    return false;
                }
                if(eee == 3){
                    // alert("验证码输入错误");
                    layer.alert("验证码输入错误",{
                        icon: 2,
                        title:false,
                        time:5000
                    })
                    return false;
                }
                if(eee == 4){
                    // alert("没有找到您的预约记录");
                    layer.alert("没有找到您的预约记录",{
                        icon: 2,
                        title:false,
                        time:5000
                    })
                    return false;
                }else{
                    window.location.href="/my_order?mobile="+mobile;
                }
            },
        });
    });

    //发送验证码
    var countdown = 60;
    function settime(obj) {
        if (countdown == 0) {
            obj.attr("onclick","getVerifyCode()");//设置onclick属性
            obj.text("获取短信验证码");
            countdown = 60;
            return;
        } else {
            obj.removeAttr("onclick");//移除onclick属性
            obj.text("重新发送(" + countdown + ")");
            countdown--;
        }
        setTimeout(function() {settime(obj) },1000);//设置定时任务，1000毫秒为1秒
    }
    function getVerifyCode(obj) {
            var mobile = $(".tell").val();
            if(mobile == ""){
                // alert("请输入手机号");
                layer.alert("请输入手机号",{
                    icon: 2,
                    title:false,
                    time:5000
                })
                return false;
            }else{
                $.ajax({
                    type: 'POST',
                    url: '/home/user/regsend',
                    data: {mobile:mobile},
                    dataType:'json',
                    success: function (eee) {
                        if(eee== 1){
                            settime($(".regsend"));//设置倒计时
                            //alert("发送成功");
                            layer.msg("发送成功",{
                                icon: 1,
                                title:false,
                                time:5000
                            })
                            return false;
                        }
                    },
                });
            }
        }


    $(".canshu").click(function(){
        var style = $(".style").val();
        if(style==0){
            return true;
        }else{
            // $(this).addClass("style1");
            $(this).attr("href","information?mobile="+style);
        }
    });
    $(".canshu1").click(function(){
        var style = $(".style").val();
        if(style==0){
            return true;
        }else{
            // $(this).addClass("style2");
            $(this).attr("href","my_order?mobile="+style);
        }
    });

    $(function(){
        if($('input').is(':checked')){
            $('.submit').html('<img src="/static/pc/img/woyaoyuyue.png" alt="">');
        }

    });
    ScrollImgLeft();
    function agree(obj){
        if($(obj).is(':checked')){
            $('.zgyy').attr('href','information').html('<img src="/static/pc/img/wyyyt.png" alt="">');
            $(".styles").val(1);
        }
        else{
            $('.zgyy').attr('onclick','').html('<img src="/static/pc/img/wyyyf.png" alt="">');
            $(".styles").val(0);
        }
    }
    $('.login input').keyup(function(){
        // if(!$(this).parent().siblings().children('input').val() == ''){
        //     $('.login a').html('<img src="/static/pc/img/login1.png" alt="">')
        // }
       $(".right").html('<img src="/static/pc/img/chax.png" alt="" width="80%">');
    });
    function logout(){

    }
    //文字横向滚动
    function ScrollImgLeft(){
        var spanWidth = $('.pad_right').width();
        var initWidth = window.screen.width - 1000;
        var widthScroll = window.screen.width - 1000;
        if(spanWidth == 0){
            $('#scroll_div').hide();
        }else{
            setInterval(function(){
                widthScroll--;
                $("#scroll_begin").css('left',widthScroll);
                if(widthScroll <=(1000-spanWidth)){
                    widthScroll = initWidth;
                }
            },24);
        }
    }

</script>
</body>
</html>